import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:share_fit/app/components/back_btn_icon.dart';
import 'package:share_fit/app/helper/ext/tr_ext.dart';
import 'package:share_fit/generated/locales.g.dart';

import 'logic.dart';

class DeepSleepPage extends StatelessWidget {
  DeepSleepPage({super.key});

  final logic = Get.put(DeepSleepLogic());
  final state = Get.find<DeepSleepLogic>().state;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: BackBtnIcon(onTap: () => logic.goBackSleepPage()),
        title: Text(LocaleKeys.sleep_deep_ratio_title_text.ts),
        centerTitle: true,
      ),
      body: Container(
        padding: EdgeInsets.symmetric(horizontal: 40.w),
        child: ListView(
          children: [
            Column(
              children: [
                SizedBox(height: 59.h),
                Text(LocaleKeys.sleep_deep_ratio_ref_value_text.ts, style: TextStyle(fontSize: 48.sp)),
                SizedBox(height: 59.h),
                Text(logic.getPercentValueText(), style: TextStyle(fontSize: 72.sp, fontWeight: FontWeight.bold)),
                SizedBox(height: 59.h),
                Container(
                  padding: EdgeInsets.symmetric(vertical: 20.w, horizontal: 55.w),
                  decoration: BoxDecoration(color: state.color, borderRadius: BorderRadius.circular(50.r)),
                  child: Text(state.level, style: const TextStyle(color: Colors.white))
                ),
                SizedBox(height: 60.h),
              ],
            ),
            Container(
              padding: EdgeInsets.symmetric(vertical: 50.w, horizontal: 55.w),
              decoration: BoxDecoration(color: Colors.white70, borderRadius: BorderRadius.circular(60.r)),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(LocaleKeys.sleep_deep_ratio_first_point_text.ts, style: TextStyle(fontSize: 52.sp)),
                  SizedBox(height: 20.h),
                  Text(LocaleKeys.sleep_deep_ratio_first_point_content_text.ts),
                  SizedBox(height: 60.h),
                  Text(LocaleKeys.sleep_deep_ratio_second_point_text.ts, style: TextStyle(fontSize: 52.sp)),
                  SizedBox(height: 20.h),
                  Text(LocaleKeys.sleep_deep_ratio_second_point_content_text.ts),
                  SizedBox(height: 60.h),
                  Text(LocaleKeys.sleep_deep_ratio_literature_title.ts, style: TextStyle(fontSize: 52.sp)),
                  SizedBox(height: 20.h),
                  Text(LocaleKeys.sleep_deep_ratio_literature_content_text.ts),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
